﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="生产计划管理2.aspx.cs" Inherits="syc.Produce.生产计划管理2" %>
<html>
<head>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">集团生产计划管理</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <input type="button" value="录 入" class="button" onclick="parent.swin_load('/Produce/生产计划录入2.aspx')"/>
        <input type="button" value="修 改" class="button" onclick="edit();"/>
        <asp:Button ID="Button_Delete" runat="server" Text="删 除" class="button" UseSubmitBehavior="false"
            onclick="Button_Delete_Click" />
    </asp:Panel>

    <asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="查 询">
年 度：<asp:DropDownList ID="NianDu" runat="server" Width="120px" AutoPostBack="true">
                    <asp:ListItem Value="0">所有计划</asp:ListItem>
                    <asp:ListItem>2008</asp:ListItem>
                    <asp:ListItem>2009</asp:ListItem>
                    <asp:ListItem>2010</asp:ListItem>
                    <asp:ListItem>2011</asp:ListItem>
                </asp:DropDownList>
        <asp:Button ID="Button_Query" runat="server" Text="查 询" CssClass="button" UseSubmitBehavior="False"  OnClick="Button_Query_Click" />
    </asp:Panel>
    
    <asp:Panel ID="Panel3" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
        
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#d0d0d0">
	            <tr>
		            <td class="grid-title">集团生产计划</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            onselected="SqlDataSource1_Selected" ></asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="20"
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="年度,月份" 
                            DataSourceID="SqlDataSource1" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="false" 
                            UseAccessibleHeader="False">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                            
                                <asp:TemplateField HeaderText="">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                        <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>
                                

                                <asp:TemplateField HeaderText="计划名称" SortExpression="计划名称">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("计划名称") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="left" Width="180px" />
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="油管(吨)" SortExpression="油管">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("油管") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                                 <asp:TemplateField HeaderText="套管(吨)" SortExpression="套管">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("套管") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                                 <asp:TemplateField HeaderText="油管接箍(支)" SortExpression="油管接箍">
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("油管接箍") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>          

                                 <asp:TemplateField HeaderText="套管接箍(支)" SortExpression="套管接箍">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("套管接箍") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField> 
                                
                                 <asp:TemplateField HeaderText="套管保护器(套)" SortExpression="套管保护器">
                                    <ItemTemplate>
                                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("套管保护器") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                            </Columns>
                            <SelectedRowStyle CssClass="grid-row-selected" />
                          </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td class="pagebar" align="right">
                                    <asp:Label ID="Label_Total" runat="server"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = function() { this.firstChild.firstChild.click(); };
        }
    }
    var year=0,month;
    <%
    if(GridView1.SelectedIndex>-1)
    {
        Response.Write("year="+GridView1.DataKeys[GridView1.SelectedIndex].Values[0]+";\n");
        Response.Write("month="+GridView1.DataKeys[GridView1.SelectedIndex].Values[1]+";");
    }
     %>
     
     function edit()//修改计划
     {
     
        if(year>0)
        {
            parent.swin_load("/Produce/生产计划录入2.aspx?y="+year+"&m="+month);
        }
        else
        {
            document.getElementById("Message").innerHTML="·请选择一个项目";
        }
     }
    document.getElementById("Button_Delete").onclick = function() {
        if(year>0)
        {
            if (confirm("确认要删除该条记录吗？")) {
                __doPostBack('Button_Delete', '');
            }
        }
    };
</script>
</body>
</html>
